<template>
	<view class="page_view">
		<view class="fankui_top">
			<view class="fankui_top_title">
				反馈描述
			</view>
			<textarea class="textarea" v-model="content" placeholder="说说您的建议或问题，以便我们提供更好的服务" placeholder-style="color: #A0A0A0;"></textarea>
			<view class="img_list" >
				<image :src="item" mode="" class="img_list_item" v-for="(item,index) in img_list"></image>
			</view>
			<view class="fankui_top_bottom flex">
				<view class="fankui_top_bottom_left" @click="choose_img">
					<image src="https://bucketoss10086.oss-cn-beijing.aliyuncs.com/images/xiangji.png" class="fankui_top_bottom_left_icon" mode=""></image>
					<view class="fankui_top_bottom_left_text">
						添加图片
					</view>
				</view>
				<view class="fankui_top_bottom_num">
					{{num}}/300
				</view>
			</view>
		</view>
		<view class="fankui_top mar20">
			<view class="fankui_top_title">
				联系方式
			</view>
			<input type="text" v-model="mobile" class="fankui_phone" placeholder="请输入您的手机号（选填）" placeholder-style="color: #A0A0A0;">
		</view>
		<view class="btn" @click="submit">
			提交
		</view>
	</view>
</template>

<script>
	import { feedback } from '../../api/common.js';
	export default {
		data() {
			return {
				mobile:'',
				content:'',
				img_list:[],
			}
		},
		computed:{
			num(){
				return this.content.length
			}
		},
		methods: {
			submit(){
				let params = {
					mobile: this.mobile,
					content: this.content,
					img: this.img_list.toString()
				}
				feedback(params).then(res=>{
					if(res.code == 200001){
						uni.showToast({
							title: '提交成功',
							icon: 'none'
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},800)
					}else{
						uni.showToast({
							title: res.message,
							icon: 'error'
						})
					}
				})
			},
			choose_img(){
				let t = this
				uni.chooseImage({
					count:1,
					success(res) {
						console.log(res)
						let path = res.tempFilePaths[0]
						t.img_list.push(path)
					}
				})
			}
		}
	}
</script>

<style>
	page{
		background: #F4F4F4;
	}
.page_view{
	padding: 0 24rpx;
	padding-top: 32rpx;
	box-sizing: border-box;
}
.fankui_top{
	width: 100%;
	/* height: 720rpx; */
	border-radius: 12rpx;
	background: #FFF;
	padding: 32rpx 24rpx;
	box-sizing: border-box;
}
.fankui_top_title{
	color: #333;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 28rpx;
	font-weight: 700;
}
.textarea{
	width: 100%;
	color: #333;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 26rpx;
	font-weight: 400;
	margin-top: 24rpx;

}
.img_list{
	display: grid;
	grid-template-columns: repeat(4, 150rpx);
	grid-gap: 20rpx 18rpx;
	margin-top: 20rpx;
}
.img_list_item{
	width: 150rpx;
	height: 150rpx;
	background: #ccc;
}
.fankui_top_bottom{
	width: 100%;
	margin-top: 30rpx;
	
}
.fankui_top_bottom_left{
	width: 128rpx;
	height: 128rpx;
	border-radius: 8rpx;
	border: 1px solid #EEE;
}
.fankui_top_bottom_left_icon{
	width: 60rpx;
	height: 60rpx;
	display: block;
	margin: 0 auto;
	margin-top: 18rpx;
}
.fankui_top_bottom_left_text{
	color: #999;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 24rpx;
	font-weight: 400;
	text-align: center;
}
.fankui_top_bottom_num{
	color: #A0A0A0;
	text-align: right;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 26rpx;
	font-weight: 400;
	margin-top: 100rpx;
}
.mar20{
	margin-top: 24rpx;
}
.fankui_phone{
	color: #333;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 26rpx;
	font-weight: 400;
	height: 80rpx;
}
.btn{
	width: 686rpx;
	height: 80rpx;
	border-radius: 40rpx;
	background: #0165FB;
	text-align: center;
	line-height: 80rpx;
	position: fixed;
	bottom: 80rpx;
	left: 32rpx;
	color: #FFF;
	text-align: center;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 28rpx;
	font-weight: 400;
}
</style>
